#include "model_data.h"
#include "model_data_reader.h"
#include "md_ver_1_0.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

ModelData::ModelData()
{
}
ModelData::~ModelData()
{

}

ModelData *ModelDataLoad(char *fileName)
{
	char *ext = strstr((fileName + strlen(fileName) - 5),".");

	FILE *fp = fopen(fileName, "rb");
	ModelData *md = 0;

	if(fp != 0)
	{
		if(!strcmp(ext,".obj"))
		{
			md = ReadObjFile(fp);
		}
		else if(!strcmp(ext,".md"))
		{
			md = ReadMDFile(fp);
		}
		else
		{
			printf("\nERROR::unknown file format... ");
		}

		
		fclose(fp);
	}

	return md;
}
